<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>基础海报模板</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: "Microsoft YaHei", Arial, sans-serif;
            background: transparent;
        }
        
        /* 海报容器 */
        .poster-container {
            width: 750px;
            height: 1334px;
            position: relative;
            overflow: hidden;
            background-color: #ffffff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        
        /* 背景图片 */
        .poster-bg {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
            object-fit: cover;
        }
        
        /* 内容区域 */
        .poster-content {
            position: relative;
            z-index: 2;
            padding: 40px;
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        
        /* 头部区域 */
        .poster-header {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .poster-title {
            font-size: 48px;
            font-weight: bold;
            color: #333;
            margin-bottom: 15px;
            line-height: 1.2;
        }
        
        .poster-subtitle {
            font-size: 28px;
            color: #666;
            line-height: 1.4;
        }
        
        /* 主要图片 */
        .poster-image {
            width: 100%;
            height: auto;
            margin: 20px 0;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        /* 正文内容 */
        .poster-body {
            flex: 1;
            display: flex;
            flex-direction: column;
        }
        
        .poster-text {
            font-size: 24px;
            line-height: 1.6;
            color: #333;
            margin-bottom: 20px;
        }
        
        /* 底部区域 */
        .poster-footer {
            margin-top: auto;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        /* 二维码 */
        .poster-qrcode {
            width: 180px;
            height: 180px;
            margin-bottom: 15px;
        }
        
        .poster-tips {
            font-size: 20px;
            color: #888;
            text-align: center;
        }
        
        /* 店铺信息 */
        .shop-info {
            display: flex;
            align-items: center;
            margin-top: 20px;
            padding: 15px;
            background-color: rgba(255, 255, 255, 0.8);
            border-radius: 10px;
        }
        
        .shop-logo {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            margin-right: 15px;
            object-fit: cover;
        }
        
        .shop-name {
            font-size: 24px;
            font-weight: bold;
            color: #333;
        }
        
        .shop-desc {
            font-size: 18px;
            color: #666;
            margin-top: 5px;
        }
        
        /* 价格标签 */
        .price-tag {
            background-color: #ff4d4f;
            color: white;
            font-size: 32px;
            font-weight: bold;
            padding: 10px 20px;
            border-radius: 8px;
            display: inline-block;
            margin: 15px 0;
        }
        
        /* 装饰元素 */
        .decoration {
            position: absolute;
            z-index: 1;
        }
        
        .decoration.top-left {
            top: 20px;
            left: 20px;
            width: 100px;
            height: 100px;
        }
        
        .decoration.bottom-right {
            bottom: 20px;
            right: 20px;
            width: 120px;
            height: 120px;
        }
    </style>
</head>
<body>
    <div class="poster-container" id="custom-poster">
        <!-- 背景图片 -->
        <img class="poster-bg" id="poster-bg" src="" alt="背景图片">
        
        <!-- 海报内容 -->
        <div class="poster-content">
            <!-- 头部区域 -->
            <div class="poster-header">
                <h1 class="poster-title" id="poster-title">海报标题</h1>
                <h2 class="poster-subtitle" id="poster-subtitle">海报副标题</h2>
            </div>
            
            <!-- 主要图片 -->
            <img class="poster-image" id="poster-image" src="" alt="主要图片">
            
            <!-- 正文内容 -->
            <div class="poster-body">
                <p class="poster-text" id="poster-text">这里是海报的详细内容描述，可以包含产品介绍、活动说明等信息。</p>
                
                <!-- 价格标签 -->
                <div class="price-tag" id="price-tag">¥99.00</div>
                
                <!-- 店铺信息 -->
                <div class="shop-info" id="shop-info">
                    <img class="shop-logo" id="shop-logo" src="" alt="店铺logo">
                    <div>
                        <div class="shop-name" id="shop-name">店铺名称</div>
                        <div class="shop-desc" id="shop-desc">店铺简介</div>
                    </div>
                </div>
            </div>
            
            <!-- 底部区域 -->
            <div class="poster-footer">
                <img class="poster-qrcode" id="poster-qrcode" src="" alt="二维码">
                <p class="poster-tips" id="poster-tips">扫描二维码了解更多</p>
            </div>
        </div>
    </div>

    <script>
        // 该函数用于根据传入的数据生成模板
        function generateTemplate(data) {
            // 默认值
            const defaults = {
                title: '海报标题',
                subtitle: '海报副标题',
                text: '这里是海报的详细内容描述，可以包含产品介绍、活动说明等信息。',
                price: '¥99.00',
                background: '',
                mainImage: '',
                qrcode: '',
                tips: '扫描二维码了解更多',
                shopName: '店铺名称',
                shopDesc: '店铺简介',
                shopLogo: '',
                isShowPrice: true,
                isShowShopInfo: true
            };
            
            // 合并数据
            const templateData = {...defaults, ...data};
            
            // 构建HTML
            let html = `
                <img class="poster-bg" id="poster-bg" src="${templateData.background || ''}" alt="背景图片">
                
                <div class="poster-content">
                    <div class="poster-header">
                        <h1 class="poster-title" id="poster-title">${templateData.title}</h1>
                        <h2 class="poster-subtitle" id="poster-subtitle">${templateData.subtitle}</h2>
                    </div>
                    
                    <img class="poster-image" id="poster-image" src="${templateData.mainImage || ''}" alt="主要图片">
                    
                    <div class="poster-body">
                        <p class="poster-text" id="poster-text">${templateData.text}</p>
                        
                        ${templateData.isShowPrice ? `<div class="price-tag" id="price-tag">${templateData.price}</div>` : ''}
                        
                        ${templateData.isShowShopInfo ? `
                        <div class="shop-info" id="shop-info">
                            <img class="shop-logo" id="shop-logo" src="${templateData.shopLogo || ''}" alt="店铺logo">
                            <div>
                                <div class="shop-name" id="shop-name">${templateData.shopName}</div>
                                <div class="shop-desc" id="shop-desc">${templateData.shopDesc}</div>
                            </div>
                        </div>
                        ` : ''}
                    </div>
                    
                    <div class="poster-footer">
                        <img class="poster-qrcode" id="poster-qrcode" src="${templateData.qrcode || ''}" alt="二维码">
                        <p class="poster-tips" id="poster-tips">${templateData.tips}</p>
                    </div>
                </div>
            `;
            
            return html;
        }
        
        // 如果是浏览器环境，监听DOM加载完成事件
        if (typeof window !== 'undefined' && typeof document !== 'undefined') {
            document.addEventListener('DOMContentLoaded', function() {
                // 可以在这里添加初始化代码
                console.log('海报模板初始化完成');
            });
        }
    </script>
</body>
</html> 